Skip to content

Comments

[1.5.x] Provide API to finish span with error#144

Merged
NipunaMadhushan merged 10 commits intoballerina-platform:1.5.xfrom
NipunaMadhushan:add-finishwitherror-api
Oct 23, 2025
Merged

[1.5.x] Provide API to finish span with error#144
NipunaMadhushan merged 10 commits intoballerina-platform:1.5.xfrom
NipunaMadhushan:add-finishwitherror-api

Conversation

@NipunaMadhushan
Copy link
Contributor

@NipunaMadhushan NipunaMadhushan commented Oct 22, 2025

Purpose

This will provide the API to to finish span with with an error.

Fixes ballerina-platform/ballerina-lang#44365

public isolated function finishSpanWithError(int spanId, error 'error) returns error?

Examples

int spanId = checkpanic observe:startSpan("Child Span");

// Do Something.
// Occurred  Error
error errorValue = error("Error Occurred");

var ret = observe:finishSpanWithError(spanId, errorValue);
  • Span View on Jaeger
Screenshot 2025-10-22 at 13 51 56
  • Span tags
Screenshot 2025-10-22 at 13 52 28

Checklist

  • Linked to an issue
  • Updated the changelog
  • Added tests

@NipunaMadhushan NipunaMadhushan changed the title Provide API to finish span with error [1.5.x] Provide API to finish span with error Oct 22, 2025
@anuruddhal anuruddhal requested a review from Copilot October 22, 2025 08:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new API finishSpanWithError() to allow spans to be finished with error information, addressing issue #44365. The implementation marks spans with error tags and properties, making errors visible in tracing tools like Jaeger.

Key changes:

  • New finishSpanWithError() function that accepts a span ID and error object
  • Error tagging mechanism using TAG_KEY_ERROR and PROPERTY_ERROR_VALUE constants
  • Version bump from 1.5.0 to 1.5.1

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
OpenTracerBallerinaWrapper.java Implements core logic to finish spans with error tags and properties
FinishSpan.java Adds public-facing wrapper method for the new error finishing capability
natives.bal Exposes the new finishSpanWithError API to Ballerina code
Ballerina.toml Updates version to 1.5.1 and adjusts distribution/dependency paths
Dependencies.toml Updates package version reference to 1.5.1

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

NipunaMadhushan and others added 4 commits October 22, 2025 14:04
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@MohamedSabthar
Copy link
Member

MohamedSabthar commented Oct 22, 2025

@NipunaMadhushan I can see a duplicate error tag in attached screenshot. Is that the expected behaviour?

Fixed it.

Screenshot 2025-10-22 at 15 09 47

@NipunaMadhushan NipunaMadhushan merged commit fd768df into ballerina-platform:1.5.x Oct 23, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants